home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 June
/
EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso
/
earcd
/
cmdity
/
clicker.lha
/
Clicker
/
Source
/
sound.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-17
|
3KB
|
79 lines
/* File: sound.h
* Created: 20-10-95
* Updated: 17-05-96
* Version: 1.3
* Project: Clicker
* Owner: Jeroen Vermeulen
* Requirements: KickStart V39+
* Legal: PD
* Status: Release
*/
/* CreateSample():
* Open audio device and sample. An IOAudio structure is returned unless either
* an error occurs or the error string was already non-NULL before the call.
* The structure is initialized for KeyClick(), ie. ready for a channel
* allocation request.
* ClickPrefs must also be properly initialized before KeyClick() can be called.
*/
struct IOAudio *CreateSample(STRPTR *const error);
/* DeleteSample():
* Destroy sample and free all resources allocated with it. This function is
* overly robust so it can be used from within CreateSample() in case of an
* error.
*/
void DeleteSample(struct IOAudio *const soundrequest);
/* KeyClick():
* Make key-click noise. The soundrequest pointer is assumed to be valid and
* non-NULL, and point at a properly initialized IOAudio structure.
* The IOAudio structure must be set up for a channel allocation request; this
* is its default state to which it is also restored at the end of the function.
* This function accesses ClickPrefs; make sure it is set up properly (and set
* its "newsettings" flag for the initial call).
*/
void KeyClick(struct IOAudio *const soundrequest);
/* SliderToHertz():
* Converts a prefs window slider position (between -5*12 and 4*12) to a
* frequency in Hertz, based on a twelve-tone octave centered at the 440 Hz A.
* This function is forced to take an unused Gadget parameter and to return LONG
* because it is passed to gadtools.library as a hook function.
*/
LONG SliderToHertz(const struct Gadget *const dum, const WORD sliderpos);
/* HertzToPeriod():
* Converts human-readable pitch in Hertz to period length suitable for use by
* audio.device. As a rule, HertzToPeriod(SliderToHertz(S)) is equivalent to
* SliderToPeriod(S).
*/
UWORD HertzToPeriod(const LONG Hertz);
/* PeriodToHertz():
* Converts audio.device period length to human-readable pitch in Hertz. This
* is the inverse of HertzToPeriod(). It needs to return LONG, so exact Hertz
* settings aren't possible.
*/
LONG PeriodToHertz(const UWORD period);
/* SliderToPeriod():
* Converts a prefs window slider position (between 0 and 9*12) to a period
* length (in units of 279.365 nanoseconds) suitable for use by audio.device.
*/
UWORD SliderToPeriod(const WORD sliderpos);
/* PeriodToSlider():
* Inverse of SliderToPeriod(). Takes a period length as an argument and
* computes the appropriate slider position (between -5*12 and 4*12). This
* function can afford to be slow because it's only ever called when the prefs
* window pops up.
*/
WORD PeriodToSlider(const UWORD period);